<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                xmlns:fbi="http://www.fbifaces.org"
                template="/templates/ui.xhtml">
    <ui:define name="head">
        <script type="text/javascript" src="#{request.contextPath}/UI/support/pub.js"/>
        <script type="text/javascript" language="javascript">
            document.onkeydown = function TabReplace() {
                if (event.keyCode == 13) {
                    if (event.srcElement.tagName != 'BUTTON')
                        event.keyCode = 9;
                    else
                        event.srcElement.click();
                }
            }
            function actSelect(obj) {
                var pkid=document.getElementById("form:hiPkid").value;
                if (obj=="Subctt"){
                    var sfeature = "dialogwidth:1300px;dialogheight:700px;center:yes;location:no;help:no;resizable:no;scroll:no;status:no";
                    var arg = new Object();
                    arg.doType = "select";
                    // 分包合同
                    var rtn =dialog("../item/itemHieRelapQry_Cstpl_Sub.xhtml?strType=2&amp;strSubCttPkid="+pkid,arg,sfeature);
                }
                else if (obj=="SubcttAttachment"){
                    var rtn = window.open("/epss/servlet/ShowServlet?operType=Qry&amp;strType=0&amp;strPkid="+pkid+"",
                            'popupwindow',
                            'height = 300,width = 450,location = no,resizable = no,scrollbars = no,status = no,toolbar = no,top = 100');
                }
            }
        </script>
        <style type="text/css">
            .c_c {
                background:gray;
            }
            .p_c {
                background:green;
            }
        </style>
    </ui:define>
    <ui:define name="content">
        <div style="margin:5px;">
            <h:form id="form">
                <p:growl id="msgs" showDetail="false"/>
                <h:inputHidden id="hiPkid" value="#{itemHieRelapStlEngPAction.esStlSubcttEngHeader.strSubcttPkid}"></h:inputHidden>

                <p:panel header="分包合同工程价格结算" style="width: 100%">
                    <h:panelGrid columns="4">
                        <h:outputLabel value="工程名称：" for="id" style="font-weight: bold"/>
                        <h:outputText id="id" value="#{itemHieRelapStlEngPAction.esStlSubcttEngHeader.strTkcttName}"/>

                        <h:outputLabel value="结算单编号：" for="strStlId" style="font-weight: bold"/>
                        <h:outputText id="strStlId" value="#{itemHieRelapStlEngPAction.esStlSubcttEngHeader.strStlId}"/>

                        <h:outputLabel value="工程项目：" for="strSubcttName" style="font-weight: bold"/>
                        <h:outputText id="strSubcttName" value="#{itemHieRelapStlEngPAction.esStlSubcttEngHeader.strSubcttName}"/>

                        <h:outputLabel value="协作合同编号：" for="strSubcttId" style="font-weight: bold"/>
                        <h:outputText id="strSubcttId" value="#{itemHieRelapStlEngPAction.esStlSubcttEngHeader.strSubcttId}"/>

                        <h:outputLabel value="协作队伍：" for="strSignPartName" style="font-weight: bold"/>
                        <h:outputText id="strSignPartName" value="#{itemHieRelapStlEngPAction.esStlSubcttEngHeader.strSignPartName}"/>

                        <h:outputLabel value="日期：" for="strDate" style="font-weight: bold"/>
                        <h:outputText id="strDate" value="#{itemHieRelapStlEngPAction.esStlSubcttEngHeader.strDate}"/>
                    </h:panelGrid>
                    <p:dataTable id="pdt" style="heiht:100%;width:100%;"
                             value="#{itemHieRelapStlEngPAction.itemStlSubcttEngPMngList}"
                             var="record"
                             rowKey="#{record.subctt_Pkid}"
                             selectionMode="single"
                             paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink}
                                            {LastPageLink} {RowsPerPageDropdown}"
                             paginator="true"
                             paginatorPosition="bottom"
                             rows="20"
                             rowsPerPageTemplate="200,100,50,40,30,20,10"
                             rowIndexVar="row"
                             emptyMessage="数据记录为空..."
                             widgetVar="dtItemDetail"
                             rowStyleClass="#{record.subctt_Name eq '小计'? 'c_c':
                                                 record.subctt_Name eq '本期净结算额'? 'p_c':
                                                 record.subctt_Name eq '合计(扣除其它栏款项后本期结算价值)'?'p_c':
                                                 record.subctt_Name eq '其中:安全施工措施费'?'c_c':
                                                 record.subctt_Name eq '质保金'? 'p_c':null}"
                             scrollable="true"
                             scrollHeight="500">

                        <p:column headerText="序号" style="width:30px">
                            <h:outputText value="#{row + 1}"/>
                        </p:column>

                        <p:column headerText="编号" style="width:100px">
                            <h:outputText value="#{record.subctt_StrNo}" escape="false"/>
                        </p:column>

                        <p:column headerText="分项项目名称" style="width:200px">
                            <h:outputText value="#{record.subctt_Name}" />
                        </p:column>

                        <p:column headerText="单位" style="width:60px">
                            <h:outputText value="#{record.subctt_Unit}" style="text-align:right"/>
                        </p:column>

                        <p:column headerText="合同单价" style="width:100px">
                            <h:outputText value="#{record.subctt_ContractUnitPrice}" style="float: right" >
                                <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                            </h:outputText>
                        </p:column>

                        <p:column headerText="合同数量" style="width:100px">
                            <h:outputText value="#{record.subctt_ContractQuantity}" style="float: right" >
                                <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                            </h:outputText>
                        </p:column>

                        <p:column headerText="合同金额" style="width:100px">
                            <h:outputText value="#{record.subctt_ContractAmount}" style="float: right" >
                                <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                            </h:outputText>
                        </p:column>

                        <p:column headerText="本期_数量" style="width:100px">
                            <h:outputText value="#{record.engPMng_CurrentPeriodEQty}" style="float: right">
                                <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                            </h:outputText>
                        </p:column>

                        <p:column headerText="本期_金额" style="width:100px">
                            <h:outputText value="#{record.engPMng_CurrentPeriodAmt}" style="float: right">
                                <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                            </h:outputText>
                        </p:column>

                        <p:column headerText="开累_数量" style="width:100px">
                            <h:outputText value="#{record.engPMng_BeginToCurrentPeriodEQty}" style="float: right">
                                <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                            </h:outputText>
                        </p:column>

                        <p:column headerText="开累_金额" style="width:100px">
                            <h:outputText value="#{record.engPMng_BeginToCurrentPeriodAmt}" style="float: right">
                                <f:convertNumber type="number" pattern="#,###,###,###,##0.00"/>
                            </h:outputText>
                        </p:column>

                        <p:column headerText="备注内容" style="width:200px">
                            <h:outputText value="#{record.subctt_Note}" />
                        </p:column>

                        <f:facet name="footer">
                            <div style="text-align: left">
                                <p:commandButton value="导出到EXCEL"
                                                 action="#{itemHieRelapStlEngPAction.onExportExcel}"
                                                 ajax="false"
                                                 rendered="#{itemHieRelapStlEngPAction.strExportToExcelRendered}">
                                </p:commandButton>
                                <p:commandButton value="分包合同"
                                                 oncomplete="actSelect('Subctt')"
                                                 rendered="false">
                                </p:commandButton>
                                <p:commandButton value="分包合同附件"
                                                 oncomplete="actSelect('SubcttAttachment')"
                                                 rendered="#{itemHieRelapStlEngPAction.strExportToExcelRendered}">
                                </p:commandButton>
                            </div>
                        </f:facet>
                    </p:dataTable>
                </p:panel>
            </h:form>
        </div>
    </ui:define>
</ui:composition>